package com.p2p.auth.domain.entity;

import com.p2p.auth.common.enums.RoleType;
import com.p2p.auth.common.enums.Whether;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 *
 * @author Antinomy
 * @date 17/7/25
 */
@Entity
@Table(name ="t_user_role")
@DynamicInsert
@DynamicUpdate
@EntityListeners(AuditingEntityListener.class)
@Data
public class UserRole extends IdEntity {

    private static final long serialVersionUID = 1349148331171687597L;
    @Column(columnDefinition = "varchar(50) NOT NULL comment '角色id'")
    private String roleId;

    @Column(columnDefinition = "varchar(50) comment '角色名称'")
    private String name;

    @Column(columnDefinition = "varchar(40) NOT NULL comment '角色类型' ")
    @Enumerated(EnumType.STRING)
    private RoleType roleType;

    @Column(columnDefinition = "varchar(255) comment '描述'")
    private String description;

    @Column(columnDefinition = "varchar(10) comment '创建人'")
    private String creator;

    @Column(columnDefinition = "varchar(10) NOT NULL comment '是否删除'")
    @Enumerated(EnumType.STRING)
    private Whether deleted = Whether.NO;
}
